var Nightmare = require("nightmare");
var nightmare = Nightmare({show: true});

nightmare
  .goto('http://yahoo.com')
  .type('input[title="Search"]', 'github nightmare')
  .click('#uh-search-button')
  .wait('#main')
  .evaluate(function(){
    return document.querySelector('#main .searchCenterMiddle li a').href
  })
  .end()
  .then(function(result){
    console.log("search reuslt is :")
    console.log(result)
  })
